package com.usian.feign;

import com.usian.pojo.User;
import com.usian.query.UserDto;
import com.usian.utils.PageResult;
import com.usian.utils.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "provider")
public interface UserFeign {

    /**
     * feign 传参
     * get  ？ feign privider consumer  @RequestParam
     *      /  @PathVariable    多个参数都需要加
     *
     * post 对象  @RequestBody  封装dto   参数列表中只能有一个请求体
     * @return
     */


    @RequestMapping("/list")
    public List<User> list();

    @GetMapping("/findById/{id}")
    public User findById(@PathVariable Integer id);

    @GetMapping("/findByIds")
    public User findByIds(@RequestParam Integer id,@RequestParam String name);

    @RequestMapping("/findPage")
    public PageResult<User> findPage(@RequestBody UserDto dto);

    @PostMapping("/saveUser")
    public boolean saveUser(@RequestBody User user);

    @GetMapping("/deleteById")
    public boolean deleteById(@RequestParam Integer id);

    @RequestMapping("/login")
    public User login(@RequestBody User user);


}
